﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using AutoHistory.Core;
using System.Reflection;

namespace AutoHistory2010ForWord
{
    public partial class RibbonAutoHistory
    {
        private void RibbonAutoHistory_Load(object sender, RibbonUIEventArgs e)
        {
        }
        
        private void toggleButton1_Click(object sender, RibbonControlEventArgs e)
        {
            Globals.ThisAddIn.taskPane.Visible = toggleButton1.Checked;
            HistoryTaskPane form = Globals.ThisAddIn.taskPane.Control as HistoryTaskPane;
            if (form != null)
            {
                form.UpdateHistory();
            }

            try
            {
                Settings.Instance.IsPaneVisible = Globals.ThisAddIn.taskPane.Visible;
                Settings.Instance.Save();
            }
            catch { }
        }

        private void buttonSettings_Click(object sender, RibbonControlEventArgs e)
        {
            using (SettingsForm settings = new SettingsForm())
            {
                settings.ShowDialog();
            }
        }

        private void group1_DialogLauncherClick(object sender, RibbonControlEventArgs e)
        {
            string version = "v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(3);
            System.Windows.Forms.MessageBox.Show("AutoHistory " + version + Environment.NewLine + Environment.NewLine + "(C)opyright Marco Wiedemeyer (http://mwiedemeyer.de/AutoHistory)", "AutoHistory", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
        }
    }
}
